package spittr.data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public class Spitter
{
    private Long id;

    @NotNull
    @Size(min = 4, max = 16, message = "{name.size}")
    private String name;

    @NotNull
    @Size(min = 2, max = 30, message = "{nickname.size}")
    private String nickname;

    @NotNull
    @Size(min = 5, max = 25, message = "{password.size}")
    private String password;

    public Spitter()
    {
        super();
    }

    public Spitter(String name, String nickname, String password)
    {
        this(null, name, nickname, password);
    }

    public Spitter(Long id, String name, String nickname, String password)
    {
        this.id = id;
        this.name = name;
        this.nickname = nickname;
        this.password = password;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getNickname()
    {
        return nickname;
    }

    public void setNickname(String nickname)
    {
        this.nickname = nickname;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public Long getId()
    {
        return id;
    }

    @Override
    public int hashCode()
    {
        return HashCodeBuilder.reflectionHashCode(this, "id");
    }

    @Override
    public boolean equals(Object obj)
    {
        return EqualsBuilder.reflectionEquals(this, obj, "id");
    }

}
